<?php
//目标模型
class MemberPhysicalTargentModel extends MY_Model {
	function __construct(){
		parent::__construct();
		$this->table = 'user_physical_target';
	}
	
	function get_data($uid){
		
		
		$sql = "select * from ".$this->db->dbprefix."user_physical_type limit 100";
		$query = $this->db->query($sql);
		$res = $query->result_array();
		
		$ids = array();
		$data = array();
		foreach($res as $val){
			
			$sql  = "select value from ".$this->db->dbprefix.$this->table." where user_id='{$uid}' AND type_id ='{$val['id']}' limit 1";
			$query = $this->db->query($sql);
			$row = $query->row_array();

			
			$data[$val['code']] = isset($row['value'])?$row['value']:'';
		}
		
		return $data;
	}
	

}

